//
//  OpenGLESBasicDrawer.m
//  TestGameEngine
//
//  Created by Louis CHU on 21/03/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "OpenGLES1BasicDrawer.h"
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
@implementation OpenGLES1BasicDrawer
+ (void) drawLineFromPoint:(CGPoint) fromPoint toPoint:(CGPoint) toPoint color:(UIColor*) color
{
    
    const GLfloat lineVertices[] = {
        fromPoint.x, fromPoint.y,
        toPoint.x, toPoint.y
    };
    const CGFloat *components = CGColorGetComponents(color.CGColor);
    
    glPushMatrix();
    
    glColor4f(components[0], components[1], components[2], components[3]);    
    glVertexPointer(2, GL_FLOAT, 0, lineVertices);
    glEnableClientState(GL_VERTEX_ARRAY);
    
    glDrawArrays(GL_LINES, 0, 2);
    
    glPopMatrix();
}
@end
